package com.test.practice.reflact.bridgeandsynthetic;

import java.lang.reflect.Method;

/**
 * OutClass--Practice
 *
 * @author: Jovi
 * @createTime: 2018-01-16 17:11
 **/
public class OutClass {

    private int out;

    public void accessInnerClass() {
        InnerClass innerClass = new InnerClass();

        innerClass.in = 1;
    }

    class InnerClass {
        private int in;

        public void printOut() {
            System.out.println(out);
        }

        public int getIn() {
            return  in;
        }
    }

    public static void main(String[] args) {
        Method[] methods ;
        methods = OutClass.class.getDeclaredMethods();
        System.out.println("==============OutClass=================");
        printMethod(methods);
        methods=InnerClass.class.getDeclaredMethods();
        System.out.println("==============InnerClass=================");
        printMethod(methods);
    }

    public static void printMethod(Method[] methods) {
        for (Method method : methods) {

            System.out.println(method.toString()+"\nisBridge : "+method.isBridge() + " \nisSynthetic : "+ method.isSynthetic());
            System.out.println();
        }
    }

}
